# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pkgconf
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.9.12
pkgrel=1
pkgdesc='pkg-config compatible utility which does not depend on glib'
url='https://github.com/nenolod/pkgconf'
arch=('any')
license=('ISC')
options=('!debug' 'strip')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
conflicts=("${MINGW_PACKAGE_PREFIX}-pkg-config")
provides=("${MINGW_PACKAGE_PREFIX}-pkg-config")
source=(http://rabbit.dereferenced.org/~nenolod/distfiles//$_realname-$pkgver.tar.bz2
        0002-relocate.patch)
sha256sums=('7ec8b516e655e247f4ba976837cee808134785819ab8f538f652fe919cc6c09f'
            'b208aa88b3ab7be8425819f83ccf2ec1d3befc35b9e7b3de3a686d0e6812c0c8')

prepare() {
  cd $_realname-$pkgver
  patch -p1 -i ${srcdir}/0002-relocate.patch

  autoreconf -vfi
}

build() {
  cd $_realname-$pkgver
  ./configure --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --sysconfdir=${MINGW_PREFIX}/etc \
    --mandir=${MINGW_PREFIX}/share/man \
    --infodir=${MINGW_PREFIX}/share/info \
    --localstatedir=${MINGW_PREFIX}/var
  make
}

package() {
  cd $_realname-$pkgver
  make DESTDIR="$pkgdir" install
  cp "${pkgdir}${MINGW_PREFIX}"/bin/pkgconf "${pkgdir}${MINGW_PREFIX}"/bin/pkg-config
}
